<?php

namespace App\Model\Entity;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];


    public function getroles()
    {
        return $this->roles = $this->belongsToMany('App\Model\Entity\AdminRole', 'admin_role_users', 'user_id', 'role_id');
    }

    public function getPermissions()
    {
        return $this->belongsToMany('App\Model\Entity\AdminMenu', 'admin_user_menus', 'user_id', 'menu_id');
    }
}
